<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
 
<h:head>
<title>Home page</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<script src="http://code.jquery.com/jquery-2.0.3.js"></script>
<script type="text/javascript">
function display(){
  jQuery("#form").css("visibility","visible");
  return false;  }
</script>
</h:head>
<h:body>

<div id="topLeft">
<h:outputText id="out" value="#{UserSession.user.username}"/>
</div>

<div id="welcome">
<h:outputLabel value="Welcome to the Virtual Examination Platform"></h:outputLabel>
</div>
<div id="menu">
<h:form>
<p:commandLink id="course1" actionListener="#{CourseSession.addIndex}" ajax="false">
<h:graphicImage value="resources/images/leaf.png"></h:graphicImage> </p:commandLink>
<h:outputText value="Course1" style="margin-left:5px;"></h:outputText><br/>
<h:outputLabel value="Exam --- " style="margin-left:50px;"></h:outputLabel>
<h:commandLink  action="index.xhtml"  style="color:black; font-style:italic " onfocus="" onclick=""><h:outputText value="Status"></h:outputText></h:commandLink>
<br/>
<br/>

<p:commandLink id="course2" actionListener="#{CourseSession.addIndex}" ajax="false">
<h:graphicImage value="resources/images/leaf.png"></h:graphicImage>  </p:commandLink>
<h:outputText value="Course2" style="margin-left:5px;"></h:outputText><br/>
<h:outputLabel value="Exam --- " style="margin-left:50px;"></h:outputLabel>
<h:commandLink  action="index.xhtml"  style="color:black; font-style:italic " onfocus="" onclick=""><h:outputText value="Status"></h:outputText></h:commandLink>
<br/><br/>
<ui:repeat  var="item" value="#{CourseSession.courses}">
<h:commandLink id="course" action="#{CourseSession.testMethod(item)}" ajax="true">
<h:graphicImage value="resources/images/leaf.png"/>  </h:commandLink>
<h:outputText value="#{item}" style="margin-left:5px;"></h:outputText><br/>
<h:outputLabel value="Exam --- " style="margin-left:50px;"></h:outputLabel>
<h:commandLink  action="index.xhtml"  style="color:black; font-style:italic " onfocus="" onclick=""><h:outputText value="Status"></h:outputText></h:commandLink>
<br/><br/>
</ui:repeat>

</h:form>
</div>

<div id="addPanel">
<h:form id="form">
<ui:insert>
  Course Name: <h:inputText id="courseName" style="border-radius:5px;" value="#{CourseSession.name}" > </h:inputText>
  </ui:insert>
</h:form>
</div>

<div id="addsAnd">
<h:form>
<ui:insert>
<h:commandButton id = "add" class="adds" value="Add Course" style="margin-right:180px;margin-left:200px" onclick="var result=display(); return result;" ></h:commandButton>
<h:commandButton id = "remove" class="adds" value="Delete Course" actionListener="#{CourseSession.deleteCourses}" update="@All"></h:commandButton>
</ui:insert>
</h:form>
</div>
<script>
jQuery.noConflict();
var usertype = "#{UserSession.user.typeOfUser}";
if(usertype=="Student")
	jQuery(".adds").css("visibility","hidden");
</script>
</h:body>
</html>